/**
 * 医院设置相关请求方法
 */
import React from 'react'
import {request} from '@utils/http'
import { IAddHospitalSetParams, IHospitalSetItem, IHospitalSetParams, IHospitalSetResponse } from './model/hospitalSetTypes'
/**
 * 获取医院设置分页数据接口
 * @param param0 {page:当前页,limit:每页几条,hosname:医院名,hoscode:医院编号}
 * @returns 
 */
export const getHospitalSetList = ({page,limit,hosname,hoscode}:IHospitalSetParams)=>{
    return request.get<any,IHospitalSetResponse>(`/admin/hosp/hospitalSet/${page}/${limit}`,{
        params:{
            hosname,
            hoscode
        }
    })
}
/**
 * 添加医院设置
 * @param data 请求体数据 {hosname,hoscode, apiUrl, contactsName, contactsPhone}
 * @returns null
 */
export const addHospitalSet = (data:IAddHospitalSetParams)=>{
    return request.post<any,null>('/admin/hosp/hospitalSet/save', data)
}
/**
 * 根据id删除医院设置
 * @param id 
 * @returns null
 */
export const deleteById = (id:string | number)=>{
    return request.delete('/admin/hosp/hospitalSet/remove/' + id)
}
/**
 * 根据id获取医院设置数据
 * @param id 
 * @returns Promise<IHospitalSetItem>
 */
export const getHospitalSetById = (id: string | number)=>{
    return request.get<any,IHospitalSetItem>('/admin/hosp/hospitalSet/get/' + id);
}
/**
 * 更新医院设置数据
 * @param data  {id,hosname,hoscode,apiUrl,contactsName, contactsPhone}
 * @returns  null
 */
export const updateHospitalSet = (data:IAddHospitalSetParams)=>{
    return request.put<any,null>('/admin/hosp/hospitalSet/update',data)
}
/**
 * 根据id列表批量删除
 * @param ids string|number[]
 * @returns null
 */
export const removeBatch = (ids:React.Key[])=>{
    return request.delete('/admin/hosp/hospitalSet/batchRemove',{
        data:ids
    })
}